import request from '@/router/axios';
export const loginByUsername = (username, password, captchaCode, uuid) => request({
    url: '/oauth/token',
    method: 'post',
    meta: {
        isToken: false,
        isSerialize: true
    },
    data: {
        client_id: 'admin-app',
        client_secret: '123456',
        grant_type: 'password',
        username: username,
        password: password,
    },
    headers: {
        captchaCode: captchaCode,
        uuid: uuid
    }
})

export const getUserInfo = () => request({
    url: '/sys/user/info',
    method: 'post'
});

export const refeshToken = (s) => request({
    url: '/oauth/token',
    method: 'post',
    meta: {
        isSerialize: true
    },
    data: {
        client_id: 'admin-app',
        client_secret: '123456',
        grant_type: 'refresh_token',
        refresh_token: s,
    }
})

export const getMenu = (type = 0) => request({
    url: '/sys/rbac/getRouters',
    method: 'post',
    data: {
        type
    }
});

export const getTopMenu = () => request({
    url: '/user/getTopMenu',
    method: 'get'
});

export const sendLogs = (list) => request({
    url: '/user/logout',
    method: 'post',
    data: list
})

export const logout = () => request({
    url: '/oauth/logout',
    method: 'post'
})
/**
 * 获取图片验证码
 * @returns 
 */
export const captchaImage = () => request({
    url: '/captchaImage',
    method: 'post'
})